package org.snusmumr.android.media.tools;

public class ModelBuilder {
	private ModelDataProvider provider;
	
	
	public ModelBuilder(ModelDataProvider context) {
		this.provider = context;
	}
	
	public ModelItem buildItem() throws ParseException {
		ModelItem item = new ModelItem();
		
		item.setAuthor(new ModelAuthor(provider.getAuthor()));
		item.setComment(provider.getItemComment());
		item.setName(provider.getItemName());
		String[] labelsStr = provider.getItemLabels();
		if(labelsStr != null) {
			ModelLabel[] labels = new ModelLabel[labelsStr.length];
			for (int i = 0; i < labelsStr.length; i++) {
				labels[i] = new ModelLabel(labelsStr[i]);
			}
			item.setLabels(labels);
		}
		item.setCategory(provider.getCategory());
		
		return item;
	}
}
